//
//  SearchView.m
//  NoNeedle
//
//  Created by chirui on 17/3/6.
//  Copyright © 2017年 chirui. All rights reserved.
//

#import "SearchView.h"

@implementation SearchView


+(UIView *)creatSearchTextFieldForDelegate:(id)deledate Placeholder:(NSString *)placeholderStr {


    UIView * searchView =[[UIView alloc]initWithFrame:CGRectMake(30, -3, [UIScreen mainScreen].bounds.size.width - 150, 30)];
    searchView.layer.cornerRadius = 3.f;
    searchView.layer.masksToBounds = YES;
    searchView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    UIImageView * searchImage =[[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 20, 20)];
    searchImage.image =[UIImage imageNamed:@"icon_nav_headline"];
    [searchView addSubview:searchImage];
    
    
    UITextField * searchText =[[UITextField alloc]initWithFrame:CGRectMake(30, 0, CGRectGetWidth(searchView.frame)-40, 30)];
//    searchText.placeholder = placeholderStr;
    searchText.font =[UIFont systemFontOfSize:15];
    searchText.delegate = deledate;
    searchText.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholderStr attributes:@{NSForegroundColorAttributeName: [UIColor lightGrayColor]}];
    [searchView addSubview:searchText];
    
    return searchView;
    

}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
